﻿using System;using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Vra.BusinessLayer;
using Vra.Dto;

namespace Vra.Components.ViewModels
{
	public class ArtistListViewModel : BaseViewModel
	{
		public ObservableCollection<ArtistDto> Artists { get; private set; }

		public ArtistListViewModel()
		{
			Artists = new ObservableCollection<ArtistDto>();
			RefreshCommand = new RelayCommand(RefreshArtists);
		}

		public ICommand RefreshCommand { get; private set; }

		private void RefreshArtists(object arg)
		{
			var process = ProcessFactory.GetArtistProcess();
			Artists.Clear();
			var items = process.GetList();
			foreach (var artistDto in items)
			{
				Artists.Add(artistDto);
			}
			Raise("Artists");
		}
	}
}
